import { IPSDEDataExport } from './ipsdedata-export';
import { IPSDEDataExportGroup } from './ipsdedata-export-group';
import { IPSLanguageRes } from '../../res/ipslanguage-res';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSDEDataExportGroupImpl extends PSModelObjectImpl implements IPSDEDataExportGroup {
  get align(): 'LEFT' | 'CENTER' | 'RIGHT' {
    return this.M.align;
  }

  protected cappslanguageres: IPSLanguageRes | null = null;

  getCapPSLanguageRes(): IPSLanguageRes | null {
    if (this.cappslanguageres != null) return this.cappslanguageres;
    const value = this.M.getCapPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.cappslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getCapPSLanguageRes') as IPSLanguageRes;
    return this.cappslanguageres;
  }

  get capPSLanguageRes(): IPSLanguageRes | null {
    return this.getCapPSLanguageRes();
  }

  getCapPSLanguageResMust(): IPSLanguageRes {
    const value = this.getCapPSLanguageRes();
    if (value == null) {
      throw new Error('未指定标题语言资源');
    }
    return value;
  }

  get caption(): string {
    return this.M.caption;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get groupLevel(): number {
    return this.M.groupLevel != null ? this.M.groupLevel : 1;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected parentpsdedataexportgroup: IPSDEDataExportGroup | null = null;

  getParentPSDEDataExportGroup(): IPSDEDataExportGroup | null {
    if (this.parentpsdedataexportgroup != null) return this.parentpsdedataexportgroup;
    const value = this.M.getParentPSDEDataExportGroup;
    if (value == null) {
      return null;
    }
    const ipsdedataexport = this.getParentPSModelObject('dataentity.dataexport.IPSDEDataExport') as IPSDEDataExport;
    if (ipsdedataexport != null) {
      this.parentpsdedataexportgroup = ipsdedataexport.findPSDEDataExportGroup(value);
    }
    return this.parentpsdedataexportgroup;
  }

  get parentPSDEDataExportGroup(): IPSDEDataExportGroup | null {
    return this.getParentPSDEDataExportGroup();
  }

  getParentPSDEDataExportGroupMust(): IPSDEDataExportGroup {
    const value = this.getParentPSDEDataExportGroup();
    if (value == null) {
      throw new Error('未指定父数据导出分组');
    }
    return value;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get cls(): string {
    return 'PSDEDataExportGroupImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'dataentity.dataexport.IPSDEDataExportGroup') return true;
    return super.instanceof(cls);
  }
}
